package cm.studapp.database;

public class DbQuerys {

	private String createTableEventos="CREATE TABLE Eventos (id INTEGER PRIMARY KEY, nombre TEXT, horaInicio INTEGER, horaTermino INTEGER)";
	private String insertEvent="INSERT INTO Eventos (nombre, horaInicio,HoraTermino) VALUES (?, ?, ?)";
	private String getAllEvents="SELECT * FROM Eventos";
    private String getTodayAgenda = "SELECT * FROM act_repetida, modulo WHERE modulo.actividad_id = act_repetida.id" +
    		" AND modulo.hora_inicio > ? AND modulo.hora_termino < ? ORDER BY modulo.hora_inicio";
    private String getTodayDutys = "SELECT de.nombre, de.hora_inicio, de.hora_termino, de.tipo, ac.nombre " +
    		"FROM deber AS de, act_repetida AS ac " +
    		"WHERE de.ramo_id=ac.id AND de.hora_inicio > ? AND de.hora_termino < ? "+
    		"AND de.consultada = 0 ORDER BY de.hora_inicio";
    private String getPartialStat = "SELECT SUM(cumplidos), SUM(no_cumplidos) FROM estadistica "+
    		"WHERE tipo = ?";
    private String getStats = "SELECT SUM(cumplidos), SUM(no_cumplidos) FROM estadistica "+
    		"WHERE tipo = ? AND hora_termino > ?";
    private String getStats2 = "SELECT SUM(cumplidos), SUM(no_cumplidos) FROM estadistica "+
    		"WHERE hora_termino > ?";
    private String getWeekModules = "SELECT * FROM modulo WHERE actividad_id=? AND hora_inicio > ? AND hora_termino < ?";
    private String getHomeworks = "SELECT * FROM deber WHERE consultada=0 AND ramo_id=? AND hora_termino > ? AND tipo= ? "; 

	
	
	public DbQuerys() {
		// TODO Auto-generated constructor stub
	}
	
	public String getQuery(String name){
		if(name.equals("createTableEventos"))
			return createTableEventos;
		else if(name.equals("getAllEvents"))
			return getAllEvents;
		else if(name.equals("getTodayAgenda"))
			return getTodayAgenda;
		else if(name.equals("getPartialStat"))
			return getPartialStat;
		else if(name.equals("getWeekModules"))
			return getWeekModules;
		else if(name.equals("getHomeworks"))
			return getHomeworks;
		else if(name.equals("getStats"))
			return getStats;
		else if(name.equals("getStats2"))
				return getStats2;
		else if(name.equals("getTodayDutys"))
			return getTodayDutys;
		else
			return null;
	
	}

}
